<template>
    <template v-for="item in data">
        <el-sub-menu v-if="item.children?.length > 0" :index="item.ename" :key="item.ename">
            <template #title>{{ item.menuName }}</template>
            <SubItem :data="item.children"></SubItem>
        </el-sub-menu>
        <el-menu-item v-else :index="item.ename" :key="item.ename" @click="toView(item)">
            {{ item.menuName }}
        </el-menu-item>
    </template>
</template>

<script setup>
import { defineProps } from 'vue';
import { useRouter } from 'vue-router'
import useSys from '@/store/useSys.js'
let router = useRouter()
let sys = useSys()
let props = defineProps(["data"])
let toView = (item) => {
    router.push(item.path)
    sys.handleClickMenu(item);
}
</script>

<style lang='scss' scoped></style>
